package com.chuangke.sinotrukbudget.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.chuangke.core.http.HttpResult;
import com.chuangke.sinotrukbudget.service.BudgetQueryService;

/**
 * bpc预算上报对象Controller
 * 
 * @author chuangke
 * @date "2022-10-21"
 */
@RestController
@RequestMapping("/budget/plan")
public class BudgetBpcPlanQueryController {

	@Autowired
	private BudgetQueryService budgetQueryService;
	
	

	/**
	 * 预算提报进度总览
	 * 
	 * @param params
	 * @return
	 */
	@SuppressWarnings("unchecked")
	@PreAuthorize("hasAuthority('login:action')")
	@PostMapping("/reportedoverview")
	public HttpResult list(@RequestBody Map<String, Object> params) {
		String period =(String) params.get("period");
		String tCategory = (String) params.get("category");
		List<String> deptIds = (List<String>) params.get("deptids");
		String deptfilter = (String) params.get("dept");
		return HttpResult.ok(budgetQueryService.queryDeptReportedOverview(tCategory,period, deptfilter,deptIds));
	}
}
